<template>
  <div></div>
</template>

<script>
// 3、使用filter过滤去除name大于4的对象 [{name:1, id: 1}, {name:2, id:2}, {name: 3， id: 3}, {name:4， uid:4}]
export default {
  setup() {
    let arr = [
      { name: 1, id: 1 },
      { name: 2, id: 2 },
      { name: 3, id: 3 },
      { name: 4, uid: 4 },
      { name: 5, uid: 5 },
    ];
    let newArr = arr.filter((obj) => obj.name <= 4);
    console.log(newArr);
    return {
      arr,
      newArr
    };
  },
};
</script>

<style lang="scss" scoped></style>
